<script lang="ts" setup name="AdvertisingColumn">
import { onMounted } from "vue";
import { Props } from "./AdvertisingColumn.d.ts";

const props = defineProps<Props>();
const logProps = () => {
  console.log(props);
};
onMounted(() => {
  logProps();
});
</script>

<template>
  <div style="padding: 5px">
    <div class="container-box">
      <div class="title" v-if="props.datas.isShowTitle">{{ props.datas.title }}</div>
      <div class="content" :style="{ width: props.datas.list.length * 110 + 'px' }">
        <div v-for="(item, index) in props.datas.list" :key="index">
          <img
            src="@/assets/images/empty-banner.png"
            :style="{ height: props.datas.height * 2 + 'px' }"
            alt=""
            v-if="!item.image"
          />
          <img :src="item.image" :style="{ height: props.datas.height * 2 + 'px' }" alt="" v-else />
          <!-- <div class="name">{{ item.linkName ? item.linkName : "商品名称" }}</div> -->
          <div class="name">{{ item.linkName ? item.linkName : "原料名称" }}</div>
          <div class="desc">{{ item.linkDesc ? item.linkDesc : "活动描述" }}</div>
        </div>
      </div>
      <slot name="deles" />
    </div>
  </div>
</template>

<style lang="scss" scoped>
.container-box {
  width: 100%;
  overflow-x: auto;
  background-color: #fffaee;
  border-radius: 5px;
  .title {
    padding-left: 10px;
    font-size: 14px;
    line-height: 30px;
    color: #606266;
  }
  .content {
    display: flex;
    margin-top: 5px;
    & > div {
      box-sizing: border-box;
      width: 110px;

      // min-height: 200px;
      padding: 5px;
      img {
        width: 100%;
        height: 150px;
      }
      .name {
        font-size: 12px;
        font-weight: 600;
        line-height: 20px;
      }
      .desc {
        font-size: 10px;
        line-height: 16px;
        color: #919191;
      }
    }
  }
}
</style>
